package com.videoaggre.zcl.ui.activity.qiman

import androidx.fragment.app.Fragment
import com.videoaggre.zcl.R
import com.videoaggre.zcl.common.tabData
import com.videoaggre.zcl.ui.activity.BaseActivity
import com.videoaggre.zcl.ui.fragment.qiman.QimanHistoryFragment
import com.videoaggre.zcl.ui.fragment.qiman.QimanHomeFragment
import com.videoaggre.zcl.ui.listener.OnTabSelectListener
import com.videoaggre.zcl.utils.FragmentChangeManager
import kotlinx.android.synthetic.main.qiman_activity_main.*
import java.util.*

class QimanMainActivity : BaseActivity(R.layout.qiman_activity_main) {
    private var mFragmentChangeManager: FragmentChangeManager? = null
    override fun initView() {
        tabLayout.tabData {
            tab("首页", R.mipmap.ic_tab_home_hl, R.mipmap.ic_tab_home_no)
            tab("分类", R.mipmap.ic_tab_class_hl, R.mipmap.ic_tab_class_no)
            tab("历史", R.mipmap.ic_tab_book_hl, R.mipmap.ic_tab_book_no)
        }
        tabLayout.setOnTabSelectListener(OnTabSelectListener { mFragmentChangeManager?.setFragments(it) })
        val fragments = ArrayList<Fragment>()
        fragments.add(QimanHomeFragment())
        fragments.add(Fragment())
        fragments.add(QimanHistoryFragment())
        mFragmentChangeManager = FragmentChangeManager(supportFragmentManager, R.id.frameLayout, fragments)
    }
}